package com.yaowk.common.ext;

import com.jfinal.render.JsonRender;
import com.jfinal.render.Render;
import com.jfinal.render.RenderFactory;
import com.yaowk.common.model.element.RespBody;

/**
 * 异常返回处理
 *
 * @authc yaowk
 * 2017/6/28
 */
public class JsonRenderFactory extends RenderFactory {
    @Override
    public Render getErrorRender(int errorCode) {
        RespBody respBody = new RespBody();
        respBody.setCode(String.valueOf(errorCode));
        if (errorCode == 500) {
            respBody.setMsg("系统错误");
        }
        Render render = new JsonRender(respBody);
        return render;
    }
}
